import uniqueId from '@form-create/utils/lib/unique'
import { localeProps } from '../../utils'

const label = '颜色选择器'
const name = 'DkColorInput'

export default {
  menu: 'high',
  icon: 'icon-park:color-filter',
  label,
  name,
  event: ['blur', 'focus', 'change', 'input', 'clear'],
  rule() {
    return {
      type: name,
      field: uniqueId(),
      title: '颜色',
      info: '',
      $help: '',
      $required: false,
      props: {}
    }
  },
  props(_, { t }) {
    return localeProps(t, name + '.props', [
      {
        type: 'switch',
        field: 'showAlpha',
        title: '是否显示透明度',
        value: false
      },
      {
        type: 'input',
        field: 'placeholder',
        title: '占位符',
        value: '请选择颜色'
      },
      {
        type: 'input',
        field: 'colorFormat',
        title: '颜色格式',
        value: 'hex'
      },
      {
        type: 'switch',
        field: 'teleported',
        title: '是否使用 teleport 渲染',
        value: true
      }
    ])
  }
}
